package com.example.eschool.son_fragment_person;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.example.eschool.R;
import com.example.eschool.adapter.messageAdapter;
import com.example.eschool.bean.Message;

import java.util.ArrayList;
import java.util.List;


public class RecordFragment extends Fragment implements View.OnClickListener{
    View rootview;
    ListView listView;
    List<Message> messageList = new ArrayList<>();
    public RecordFragment() {
    }


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        listView = view.findViewById(R.id.record_item); // 从view中查找ListView

        for (int i = 0; i < 10; i++) {
            Message message1 = new Message("一卡通充值","农行支付，支付成功","100元","2021-06-01 10:00:00");
            messageList.add(message1);
        }

        messageAdapter adapter = new messageAdapter(getContext(), R.layout.message_item, messageList);
        listView.setAdapter(adapter);

    }
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        if (rootview == null){
            rootview=inflater.inflate(R.layout.son_fragment_record, container, false);
        }

        return rootview;
    }

    @Override
    public void onClick(View v) {

    }


}